/*
 * @Author: your name
 * @Date: 2021-12-02 09:20:15
 * @LastEditTime: 2021-12-02 10:40:50
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \li-yuwei\client\src\i18n\i18n.js
 */

import Vue from "vue";
import VueI18n from "vue-i18n";
import locale from "element-ui/lib/locale";
import zh from "./zh";
import en from "./en";
import enLocale from "element-ui/lib/locale/lang/en";
import zhLocale from "element-ui/lib/locale/lang/zh-CN";

Vue.use(VueI18n);

const messages = {
    en: Object.assign(en, enLocale),
    zh: Object.assign(zh, zhLocale),
};

const i18n = new VueI18n({
    locale: localStorage.getItem("locale") || "zh",
    messages,
});

locale.i18n((key, value) => i18n.t(key, value)); //为了实现element插件的多语言切换

export default i18n;